package com.farm.forms.domain;

import java.util.ArrayList;
import java.util.List;
import java.util.AbstractMap.SimpleEntry;
import java.util.Map.Entry;

/* *
 *功能：查询条件类
 *详细：
 *
 *版本：v0.1
 *作者：王东
 *日期：20141124152033
 *说明：
 */
public class Rules implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1387858137063491000L;
	private String typepara;
	private String queryid;
	private int sort;
	private String type;
	private String sign;
	private String code;
	private String title;
	private String id;
	private String sqlrule;
	private List<Entry<String, String>> enums;

	public String getTypepara() {
		return this.typepara;
	}

	public void setTypepara(String typepara) {
		this.typepara = typepara;
	}

	public String getQueryid() {
		return this.queryid;
	}

	public void setQueryid(String queryid) {
		this.queryid = queryid;
	}

	public int getSort() {
		return this.sort;
	}

	public void setSort(int sort) {
		this.sort = sort;
	}

	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getSign() {
		return this.sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getSqlrule() {
		return this.sqlrule;
	}

	public void setSqlrule(String sqlrule) {
		this.sqlrule = sqlrule;
	}

	public List<Entry<String, String>> getEnums() {
		return enums;
	}

	public void setEnums(List<Entry<String, String>> enums) {
		this.enums = enums;
	}

	public Rules parseType() {
		// 文本
		if (type.equals("1")) {

		}
		// 枚举[type:title,type2:title2,...]
		if (type.equals("2")) {
			enums = new ArrayList<Entry<String, String>>();
			if (typepara != null) {
				for (String type : typepara.split(",")) {
					String[] typeArray = type.split(":");
					enums.add(new SimpleEntry<String, String>(typeArray[0],
							typeArray[1]));
				}
			}
		}
		// 数据字典[key]
		if (type.equals("3")) {

		}
		// 日历控件[yyyyMMddHHmmss]
		if (type.equals("4")) {

		}
		return this;
	}
}